﻿using System.Configuration;
using System.Reflection;

namespace AbstractFactory
{
    class DataAccess
    {
        //private static readonly string db = "Sqlserver";
        // private static readonly string db = "Access";
        private static readonly string DB = ConfigurationSettings.AppSettings["DB"];
        private static readonly string AssemblyName = "AbstractFactory";

        /*供客户端使用的查找接口 统一封装一层*/
        public static IUser CreateUser()
        {
            string assemblyName = string.Format("{0}.{1}User", AssemblyName, DB);
            return (IUser)Assembly.Load(AssemblyName).CreateInstance(assemblyName);
        }
    }
}
